<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1 th:text="${session.get('username')}"></h1>
<a href="#" th:text="${session.get('username')}"></a>
<hr>
<a href="https://www.baidu.com" th:if="flag eq '4'">百度</a>
<script th:inline="javascript">
    let domainPath = /*[[@{/}]]*/'';
    let username = [[${session.username}]];
    let flag = [[${flag}]]
    let userInfo = [[${session.userInfo}]]

    console.log(userInfo)
    console.log(userInfo.username)


    alert(flag)
    // alert('username=' + username + " domainPath=" + domainPath)
</script>
</body>
</html>